package thread_learn2;

public class demon10 {
    static Object object=new Object();
    static  Object object1=new Object();
    public static void main(String[] args) {
        Thread thread=new Thread(()->{
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("A");
            synchronized (object){
                object.notify();
            }
        });
        Thread thread1=new Thread(()->{
            synchronized (object){
                try {
                    object.wait();
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                System.out.println("B");
            }
            synchronized (object1){
                object1.notify();
            }
        });
        Thread thread2=new Thread(()->{
            synchronized (object1){
                try {
                    object1.wait();
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                System.out.println("c");
            }
        });
        thread2.start();
        thread1.start();
        thread.start();
    }
}
